<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

abstract class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    protected function mkmap(array $arr_Data,$str_Key){
        $map_Output = [];
        foreach($arr_Data as $map_Data){
            if(isset($map_Data[$str_Key])){
                $map_Output[$map_Data[$str_Key]] = $map_Data;
            }
        }
        return $map_Output;
    }

    protected function output($code,$message,$data = []){
        return [
            'code' => $code,
            'message' => $message,
            'data' => $data
        ];
    }

    protected function isAdmin(){
        return session('isAdmin');
    }
}
